home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / reuse.lha / reuse / m2c / Layout.c < prev    next >
C/C++ Source or Header  |  1992-08-18  |  2KB  |  129 lines

  1. #include "SYSTEM_.h"
  2.  
  3. #ifndef DEFINITION_IO
  4. #include "IO.h"
  5. #endif
  6.  
  7. #ifndef DEFINITION_Layout
  8. #include "Layout.h"
  9. #endif
  10.  
  11.  
  12.  
  13.  
  14. void Layout_WriteChar
  15. # ifdef __STDC__
  16. (IO_tFile f, CHAR Ch)
  17. # else
  18. (f, Ch)
  19. IO_tFile f;
  20. CHAR Ch;
  21. # endif
  22. {
  23.   if ('!' <= Ch && Ch <= '~') {
  24.     IO_WriteC(f, '\'');
  25.     IO_WriteC(f, Ch);
  26.     IO_WriteC(f, '\'');
  27.   } else if (Ch == '\0') {
  28.     IO_WriteS(f, (STRING)"eps", 3L);
  29.   } else {
  30.     IO_WriteI(f, (LONGINT)ORD(Ch), 2L);
  31.     IO_WriteC(f, 'C');
  32.   }
  33. }
  34.  
  35. void Layout_WriteSpace
  36. # ifdef __STDC__
  37. (IO_tFile f)
  38. # else
  39. (f)
  40. IO_tFile f;
  41. # endif
  42. {
  43.   IO_WriteC(f, ' ');
  44. }
  45.  
  46. void Layout_WriteSpaces
  47. # ifdef __STDC__
  48. (IO_tFile f, INTEGER Count)
  49. # else
  50. (f, Count)
  51. IO_tFile f;
  52. INTEGER Count;
  53. # endif
  54. {
  55.   INTEGER i;
  56.  
  57.   {
  58.     LONGINT B_1 = 1, B_2 = Count;
  59.  
  60.     if (B_1 <= B_2)
  61.       for (i = B_1;; i += 1) {
  62.         IO_WriteC(f, ' ');
  63.         if (i >= B_2) break;
  64.       }
  65.   }
  66. }
  67.  
  68. void Layout_ReadSpace
  69. # ifdef __STDC__
  70. (IO_tFile f)
  71. # else
  72. (f)
  73. IO_tFile f;
  74. # endif
  75. {
  76.   CHAR Ch;
  77.  
  78.   Ch = IO_ReadC(f);
  79. }
  80.  
  81. void Layout_ReadSpaces
  82. # ifdef __STDC__
  83. (IO_tFile f, INTEGER Count)
  84. # else
  85. (f, Count)
  86. IO_tFile f;
  87. INTEGER Count;
  88. # endif
  89. {
  90.   INTEGER i;
  91.   CHAR Ch;
  92.  
  93.   {
  94.     LONGINT B_3 = 1, B_4 = Count;
  95.  
  96.     if (B_3 <= B_4)
  97.       for (i = B_3;; i += 1) {
  98.         Ch = IO_ReadC(f);
  99.         if (i >= B_4) break;
  100.       }
  101.   }
  102. }
  103.  
  104. void Layout_SkipSpaces
  105. # ifdef __STDC__
  106. (IO_tFile f)
  107. # else
  108. (f)
  109. IO_tFile f;
  110. # endif
  111. {
  112.   do {
  113.   } while (!(IO_ReadC(f) != ' '));
  114.   IO_UnRead(f);
  115. }
  116.  
  117. void BEGIN_Layout()
  118. {
  119.   static BOOLEAN has_been_called = FALSE;
  120.  
  121.   if (!has_been_called) {
  122.     has_been_called = TRUE;
  123.  
  124.     BEGIN_IO();
  125.     BEGIN_IO();
  126.  
  127.   }
  128. }
  129.